package kk.service.impl;

import com.github.pagehelper.PageHelper;
import kk.dao.PermissionDao;
import kk.domain.Permission;
import kk.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionDao permissionDao;

    @Override
    public List<Permission> findAll(Integer pageNum,Integer pageSize) throws Exception {
        PageHelper.startPage(pageNum,pageSize);
        List<Permission> permissionList = permissionDao.findAll();
        return permissionList;
    }

    @Override
    public void save(Permission permission) throws Exception {
        permissionDao.save(permission);
    }

    @Override
    public Permission findById(Integer id) throws Exception {
        Permission permission = permissionDao.findById(id);
        return permission;
    }

    @Override
    public void deleteById(Integer id) throws Exception {
        permissionDao.deleteById(id);
    }


}
